home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d897.lha / EPP / PModules / cSkipNonWhite.e < prev    next >
Text File  |  1993-06-26  |  1KB  |  34 lines

  1. OPT TURBO
  2.  
  3. PROC cSkipNonWhite (pos : PTR TO CHAR)
  4.  
  5.   /*----------------------------------------------------------------------*/
  6.   /* pos must point into a null-terminated string!                        */
  7.   /* pos must be passed by value!                                         */
  8.   /* pos must not point beyond the end of the string when it's passed in! */
  9.   /*                                                                      */
  10.   /* Skips SPACE, TAB, LF, CR.  Returns end pos so that the following     */
  11.   /* statement sequence can be used in the calling program:               */
  12.   /*   length := (cSkipNonWhite (startPos) - startPos)                    */
  13.   /*   MidStr (someString, startPos, 0, length)                           */
  14.   /*                                                                      */
  15.   /* If you use the string with index method in your main program, you    */
  16.   /* can get the PTR TO CHAR pos by using:                                */
  17.   /*   length := (cSkipNonWhite (string + index) - (string + index))      */
  18.   /*   MidStr (someString, string, index, length)                         */
  19.   /*----------------------------------------------------------------------*/
  20.   DEF c
  21.  
  22.   WHILE (c := pos [])
  23.     SELECT c
  24.       CASE  32; RETURN pos    /* SPACE */
  25.       CASE   9; RETURN pos    /* TAB */
  26.       CASE  10; RETURN pos    /* LF */
  27.       CASE  13; RETURN pos    /* CR */
  28.       DEFAULT;  INC pos
  29.     ENDSELECT
  30.   ENDWHILE
  31.  
  32. ENDPROC  pos
  33.   /* cSkipNonWhite */
  34.